package com.hrms.repository;

import com.hrms.entity.ResignationRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public interface ResignationRecordRepository extends JpaRepository<ResignationRecord, Long> {
    
    @Query("SELECT COUNT(r) FROM ResignationRecord r WHERE r.resignationDate BETWEEN :startDate AND :endDate")
    long countByDateRange(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
    
    List<ResignationRecord> findByResignationDateBetween(LocalDate startDate, LocalDate endDate);
}
